
<?php include 'header.php';?>

    <div style="overflow:hidden;font-size: 12px;border:0;background:#ede7f6;padding:10px 20px;" class="section">
        <span class="left" style="color: #333;" id="totalbook"></span>
    </div>
    <!--其他区域-->
    <section>
        <?php
            if( count($result) == 0 ){
                echo '<div style="font-size:20px;width:100%;padding-top:30px;text-align:center;">';
                echo '    w.w,竟然一本书都没借阅过';
                echo '</div>';
            }else{
                foreach($result as $key => $val){
                    $temp_key = $key+1;
                    echo '<a href="/detail?href='.$val->book_href.'" class="item block">';
                    echo '<h3 style="margin-bottom:10px;">';
                    $temp_title = str_replace('<a', '<span', $val->book_name);
                    $temp_title = str_replace('</a', '</span', $temp_title);
                    echo $temp_key.'. '.$temp_title;
                    echo '</h3>';
                    echo '    <p><span>作&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;者：</span>'.$val->book_author.'</p>';
                    echo '    <p><span>馆&nbsp;&nbsp;藏&nbsp;&nbsp;地：</span>'.$val->book_location.'</p>';
                    $rent_time_arr = explode(' ' , $val->rent_time);
                    $return_time_arr = explode(' ' , $val->return_time);
                    echo '    <p><span>借阅日期：</span>'.$rent_time_arr[0].'</p>';
                    echo '    <p><span>应还日期：</span>'.$return_time_arr[0].'</p>';
                    echo '</a>';
                }
            }
        ?>
    </section>
<?php include 'footer.php';?>
<script type="text/javascript">

$("#totalbook").html("历史借阅图书共<?php echo count($result); ?>本,最近同步时间：<?php if(!isset($sync_time) || $sync_time != '0000-00-00 00:00:00' || $sync_time == ''){echo '从未同步';}else{echo $sync_time;}; ?>");
//获取用户名
    var number = '<?php if(isset($number)){ echo $number; }else{ echo 0; } ?>';
    
    $("#topbar").html('<a onclick="history.go(-1)"><h1 class="mustfff"><i class="icon iconfont icon-left" style="margin-right:4px;"></i>历史借阅</h1></a>');
    $(window).scroll(function () {
        var scrollTop = $(this).scrollTop();
        var scrollHeight = $(document).height();
        var windowHeight = $(this).height();
        console.log(scrollTop + windowHeight ==  scrollHeight);
        if (scrollTop + windowHeight ==  scrollHeight) {
            toast("木有更多啦~");
        }
    });
</script>